package entity;

public class Student extends Person {
    private Course selectedCourse;

    public Student(String id, String name, String gender) {
        super(id, name, gender);
        this.selectedCourse = null;
    }

    public void selectCourse(Course course) {
        this.selectedCourse = course;
        System.out.println("学生" + name + "选择了课程" + course.getCourseName());
    }

    public void dropCourse() {
        if (selectedCourse != null) {
            System.out.println("学生" + name + "退选了课程" + selectedCourse.getCourseName());
            selectedCourse = null;
        } else {
            System.out.println("学生" + name + "暂无课程可退选");
        }
    }


    public void printSchedule() {
        if (selectedCourse == null) {
            System.out.println("学生" + name + "暂无选课记录");
        } else {
            System.out.println("学生课表：\n课程编号：" + selectedCourse.getCourseId() + 
                               "\n课程名称：" + selectedCourse.getCourseName() + 
                               "\n上课地点：" + selectedCourse.getClassroom() + 
                               "\n时间：" + selectedCourse.getTime() + 
                               "\n授课教师：" + selectedCourse.getTeacher().name);
        }
    }

    public Course getSelectedCourse() {
        return selectedCourse;
    }
}